package org.nobject.common.fan.datagen;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.nobject.common.lang.StringUtils;

/**
 * 手机生成器
 * 
 * @author benson
 * @version 1.0
 */
public class PhoneGen implements RandomGen {

	/**
	 * 手机[1-2]接入码
	 */
	public static String[] mobileInNos = { "13", "15" };// ,"14" 不吉利暂时不用,"18"
	// 暂未开通
	
	public static Map districtPhonePrefix=new HashMap();
	static{
		districtPhonePrefix.put("合肥市","551");districtPhonePrefix.put("黄山市","559");districtPhonePrefix.put("宿州市","557");districtPhonePrefix.put("宣城市","563");districtPhonePrefix.put("芜湖市","553");districtPhonePrefix.put("蚌埠市","552");districtPhonePrefix.put("铜陵市","562");districtPhonePrefix.put("阜阳市","558");districtPhonePrefix.put("马鞍山市","555");districtPhonePrefix.put("巢湖市","565");districtPhonePrefix.put("淮北市","561");districtPhonePrefix.put("安庆市","556");districtPhonePrefix.put("六安市","564");districtPhonePrefix.put("黄山市","559");districtPhonePrefix.put("太湖市","556");districtPhonePrefix.put("亳州市","558");districtPhonePrefix.put("淮南市","554");districtPhonePrefix.put("滁州市","550");districtPhonePrefix.put("北京市","10");districtPhonePrefix.put("通县","10");districtPhonePrefix.put("昌平县","10");districtPhonePrefix.put("门头沟区","10");districtPhonePrefix.put("燕山区","10");districtPhonePrefix.put("平谷县","10");districtPhonePrefix.put("顺义县","10");districtPhonePrefix.put("房山区","10");districtPhonePrefix.put("延庆县","10");districtPhonePrefix.put("怀柔县","10");districtPhonePrefix.put("密云县","10");districtPhonePrefix.put("大兴县","10");districtPhonePrefix.put("渝北区","23");districtPhonePrefix.put("巴南区","23");districtPhonePrefix.put("永川市","23");districtPhonePrefix.put("江津市","23");districtPhonePrefix.put("合川市","23");districtPhonePrefix.put("万县市","23");districtPhonePrefix.put("涪陵市","23");districtPhonePrefix.put("南川市","23");districtPhonePrefix.put("福州市","591");districtPhonePrefix.put("南平市","599");districtPhonePrefix.put("厦门市","592");districtPhonePrefix.put("石狮市","595");districtPhonePrefix.put("龙岩市","597");districtPhonePrefix.put("永安市","598");districtPhonePrefix.put("莆田市","594");districtPhonePrefix.put("邵武市","599");districtPhonePrefix.put("泉州市","595");districtPhonePrefix.put("漳州市","596");districtPhonePrefix.put("三明市","598");districtPhonePrefix.put("宁德市","593");districtPhonePrefix.put("兰州市","931");districtPhonePrefix.put("临夏市","930");districtPhonePrefix.put("张掖市","936");districtPhonePrefix.put("嘉峪关市","937");districtPhonePrefix.put("金昌市","935");districtPhonePrefix.put("平凉市","933");districtPhonePrefix.put("白银市","943");districtPhonePrefix.put("武威市","935");districtPhonePrefix.put("酒泉市","937");districtPhonePrefix.put("玉门市","937");districtPhonePrefix.put("天水市","938");districtPhonePrefix.put("西峰市","934");districtPhonePrefix.put("广州市 20","");districtPhonePrefix.put("东莞市","769");districtPhonePrefix.put("梅州市","753");districtPhonePrefix.put("潮州市","768");districtPhonePrefix.put("汕尾市","660");districtPhonePrefix.put("深圳市","755");districtPhonePrefix.put("茂名市","668");districtPhonePrefix.put("佛山市","757");districtPhonePrefix.put("江门市","750");districtPhonePrefix.put("清远市","763");districtPhonePrefix.put("韶关市","751");districtPhonePrefix.put("汕头市","754");districtPhonePrefix.put("惠州市","752");districtPhonePrefix.put("河源市","762");districtPhonePrefix.put("湛江市","759");districtPhonePrefix.put("肇庆市","758");districtPhonePrefix.put("中山市","760");districtPhonePrefix.put("阳江市","662");districtPhonePrefix.put("南宁市","771");districtPhonePrefix.put("百色市","776");districtPhonePrefix.put("北海市","779");districtPhonePrefix.put("桂林市","773");districtPhonePrefix.put("柳州市","772");districtPhonePrefix.put("河池市","778");districtPhonePrefix.put("凭祥市","771");districtPhonePrefix.put("钦州市","777");districtPhonePrefix.put("玉林市","775");districtPhonePrefix.put("梧州市","774");districtPhonePrefix.put("合山市","772");districtPhonePrefix.put("钦州市","777");districtPhonePrefix.put("贵阳市","851");districtPhonePrefix.put("铜仁市","856");districtPhonePrefix.put("都匀市","854");districtPhonePrefix.put("兴义市","859");districtPhonePrefix.put("赤水市","852");districtPhonePrefix.put("六盘水市","858");districtPhonePrefix.put("凯里市","855");districtPhonePrefix.put("安顺市","853");districtPhonePrefix.put("遵义市","852");districtPhonePrefix.put("毕节市","857");districtPhonePrefix.put("海口市","898");districtPhonePrefix.put("通什市","898");districtPhonePrefix.put("三亚市","898");districtPhonePrefix.put("儋州市","898");districtPhonePrefix.put("石家庄市","311");districtPhonePrefix.put("辛集市","311");districtPhonePrefix.put("邢台市","319");districtPhonePrefix.put("邯郸市","310");districtPhonePrefix.put("泊头市","317");districtPhonePrefix.put("唐山市","315");districtPhonePrefix.put("保定市","312");districtPhonePrefix.put("定州市","312");districtPhonePrefix.put("廊坊市","316");districtPhonePrefix.put("南宫市","319");districtPhonePrefix.put("衡水市","318");districtPhonePrefix.put("沙河市","319");districtPhonePrefix.put("沧州市","317");districtPhonePrefix.put("任丘市","317");districtPhonePrefix.put("秦皇岛市","335");districtPhonePrefix.put("承德市","314");districtPhonePrefix.put("涿州市","312");districtPhonePrefix.put("张家口市","313");districtPhonePrefix.put("哈尔滨市","451");districtPhonePrefix.put("肇东市","451");districtPhonePrefix.put("伊春市","458");districtPhonePrefix.put("鹤岗市","454");districtPhonePrefix.put("双鸭山市","454");districtPhonePrefix.put("牡丹江市","453");districtPhonePrefix.put("鸡西市","453");districtPhonePrefix.put("大庆市","459");districtPhonePrefix.put("黑河市","456");districtPhonePrefix.put("阿城市","450");districtPhonePrefix.put("绥化市","455");districtPhonePrefix.put("佳木斯市","454");districtPhonePrefix.put("七台河市","453");districtPhonePrefix.put("同江市","454");districtPhonePrefix.put("绥汾河市","453");districtPhonePrefix.put("齐齐哈尔市","452");districtPhonePrefix.put("北安市","456");districtPhonePrefix.put("五大连池市","456");districtPhonePrefix.put("郑州市","371");districtPhonePrefix.put("焦作市","391");districtPhonePrefix.put("鹤壁市","392");districtPhonePrefix.put("许昌市","374");districtPhonePrefix.put("驻马店市","396");districtPhonePrefix.put("周口市","394");districtPhonePrefix.put("洛阳市","379");districtPhonePrefix.put("义马市","398");districtPhonePrefix.put("开封市","378");districtPhonePrefix.put("新乡市","373");districtPhonePrefix.put("安阳市","372");districtPhonePrefix.put("濮阳市","393");districtPhonePrefix.put("缧河市","395");districtPhonePrefix.put("信阳市","376");districtPhonePrefix.put("平顶山市","375");districtPhonePrefix.put("三门峡市","398");districtPhonePrefix.put("南阳市","377");districtPhonePrefix.put("商丘市","370");districtPhonePrefix.put("武汉市 27","");districtPhonePrefix.put("天门市","728");districtPhonePrefix.put("应城市","712");districtPhonePrefix.put("仙桃市","728");districtPhonePrefix.put("荆沙市","716");districtPhonePrefix.put("荆门市","724");districtPhonePrefix.put("鄂州市","711");districtPhonePrefix.put("咸宁市","715");districtPhonePrefix.put("蒲圻市","715");districtPhonePrefix.put("老河口市","710");districtPhonePrefix.put("十堰市","719");districtPhonePrefix.put("枝城市","717");districtPhonePrefix.put("利川市","718");districtPhonePrefix.put("麻城市","713");districtPhonePrefix.put("孝感市","712");districtPhonePrefix.put("安陆市","712");districtPhonePrefix.put("江汉市","728");districtPhonePrefix.put("洪湖市","728");districtPhonePrefix.put("石首市","716");districtPhonePrefix.put("黄石市","714");districtPhonePrefix.put("武穴市","713");districtPhonePrefix.put("襄樊市","710");districtPhonePrefix.put("随州市","722");districtPhonePrefix.put("丹江口市","719");districtPhonePrefix.put("宜昌市","717");districtPhonePrefix.put("恩施市","718");districtPhonePrefix.put("长沙市","731");districtPhonePrefix.put("湘乡市","732");districtPhonePrefix.put("益阳市","737");districtPhonePrefix.put("汨罗市","730");districtPhonePrefix.put("津市","736");districtPhonePrefix.put("张家界市","744");districtPhonePrefix.put("涟源市","738");districtPhonePrefix.put("怀化市","745");districtPhonePrefix.put("衡阳市","734");districtPhonePrefix.put("邵阳市","739");districtPhonePrefix.put("永州市","746");districtPhonePrefix.put("湘潭市","732");districtPhonePrefix.put("株洲市","733");districtPhonePrefix.put("岳阳市","730");districtPhonePrefix.put("常德市","736");districtPhonePrefix.put("吉首市","7481");districtPhonePrefix.put("娄底市","738");districtPhonePrefix.put("冷水江市","738");districtPhonePrefix.put("洪江市","745");districtPhonePrefix.put("耒阳市","734");districtPhonePrefix.put("郴州市","735");districtPhonePrefix.put("冷水滩市","746");districtPhonePrefix.put("南京市 25","");districtPhonePrefix.put("镇江市","511");districtPhonePrefix.put("常州市","519");districtPhonePrefix.put("宜兴市","510");districtPhonePrefix.put("苏州市","512");districtPhonePrefix.put("徐州市","516");districtPhonePrefix.put("淮阴市","517");districtPhonePrefix.put("宿迁市","527");districtPhonePrefix.put("东台市","515");districtPhonePrefix.put("泰州市","523");districtPhonePrefix.put("南通市","513");districtPhonePrefix.put("仪征市","514");districtPhonePrefix.put("丹阳市","511");districtPhonePrefix.put("无锡市","510");districtPhonePrefix.put("江阴市","510");districtPhonePrefix.put("常熟市","520");districtPhonePrefix.put("连云港市","518");districtPhonePrefix.put("淮安市","517");districtPhonePrefix.put("盐城市","515");districtPhonePrefix.put("扬州市","514");districtPhonePrefix.put("兴化市","523");districtPhonePrefix.put("吴江市","512");districtPhonePrefix.put("南昌市","791");districtPhonePrefix.put("景德镇市","798");districtPhonePrefix.put("鹰潭市","701");districtPhonePrefix.put("新余市","790");districtPhonePrefix.put("赣州市","797");districtPhonePrefix.put("井冈山市","796");districtPhonePrefix.put("黎川市","794");districtPhonePrefix.put("九江市","792");districtPhonePrefix.put("上饶市","793");districtPhonePrefix.put("伊春市","795");districtPhonePrefix.put("萍乡市","799");districtPhonePrefix.put("吉安市","796");districtPhonePrefix.put("抚州市","794");districtPhonePrefix.put("庐山市","792");districtPhonePrefix.put("长春市","431");districtPhonePrefix.put("吉林市","432");districtPhonePrefix.put("延吉市","433");districtPhonePrefix.put("龙井市","433");districtPhonePrefix.put("通化市","435");districtPhonePrefix.put("浑江市","439");districtPhonePrefix.put("四平市","434");districtPhonePrefix.put("辽源市","437");districtPhonePrefix.put("洮南市","436");districtPhonePrefix.put("扶余市","438");districtPhonePrefix.put("桦甸市","432");districtPhonePrefix.put("图们市","433");districtPhonePrefix.put("敦化市","433");districtPhonePrefix.put("集安市","435");districtPhonePrefix.put("梅河口市","448");districtPhonePrefix.put("白城市","436");districtPhonePrefix.put("公主岭市","434");districtPhonePrefix.put("白山市","439");districtPhonePrefix.put("沈阳市 24","");districtPhonePrefix.put("铁岭市","410");districtPhonePrefix.put("抚顺市","413");districtPhonePrefix.put("海城市","412");districtPhonePrefix.put("大连市","411");districtPhonePrefix.put("本溪市","414");districtPhonePrefix.put("锦州市","416");districtPhonePrefix.put("兴城市","429");districtPhonePrefix.put("北票市","421");districtPhonePrefix.put("盘锦市","427");districtPhonePrefix.put("辽阳市","419");districtPhonePrefix.put("铁法市","410");districtPhonePrefix.put("鞍山市","412");districtPhonePrefix.put("营口市","417");districtPhonePrefix.put("瓦房店市","411");districtPhonePrefix.put("丹东市","415");districtPhonePrefix.put("锦西市","429");districtPhonePrefix.put("朝阳市","421");districtPhonePrefix.put("阜新市","418");districtPhonePrefix.put("长海市","411");districtPhonePrefix.put("呼和浩特市","471");districtPhonePrefix.put("二连浩特市","479");districtPhonePrefix.put("临河市","478");districtPhonePrefix.put("东胜市","477");districtPhonePrefix.put("满洲里市","470");districtPhonePrefix.put("赤峰市","476");districtPhonePrefix.put("乌兰浩特市","482");districtPhonePrefix.put("霍林郭勒市","475");districtPhonePrefix.put("集宁市","474");districtPhonePrefix.put("包头市","472");districtPhonePrefix.put("乌海市","473");districtPhonePrefix.put("海拉尔市","470");districtPhonePrefix.put("牙克石市","470");districtPhonePrefix.put("锡林浩特市","479");districtPhonePrefix.put("通辽市","475");districtPhonePrefix.put("扎兰屯市","470");districtPhonePrefix.put("银川市","951");districtPhonePrefix.put("青铜峡市","953");districtPhonePrefix.put("固原市","954");districtPhonePrefix.put("石嘴山市","952");districtPhonePrefix.put("吴忠市","953");districtPhonePrefix.put("西宁市","971");districtPhonePrefix.put("同仁市","973");districtPhonePrefix.put("玛沁市","975");districtPhonePrefix.put("德令哈市","977");districtPhonePrefix.put("格尔木市","979");districtPhonePrefix.put("海东市","972");districtPhonePrefix.put("共和市","974");districtPhonePrefix.put("玉树市","976");districtPhonePrefix.put("门源市","978");districtPhonePrefix.put("海晏市","970");districtPhonePrefix.put("济南市","531");districtPhonePrefix.put("临清市","635");districtPhonePrefix.put("淄博市","533");districtPhonePrefix.put("东营市","546");districtPhonePrefix.put("诸城市","536");districtPhonePrefix.put("烟台市","535");districtPhonePrefix.put("青岛市","532");districtPhonePrefix.put("莱芜市","634");districtPhonePrefix.put("济宁市","537");districtPhonePrefix.put("荷泽市","530");districtPhonePrefix.put("日照市","633");districtPhonePrefix.put("滕州市","632");districtPhonePrefix.put("聊城市","635");districtPhonePrefix.put("德州市","534");districtPhonePrefix.put("滨州市","543");districtPhonePrefix.put("潍坊市","536");districtPhonePrefix.put("青州市","536");districtPhonePrefix.put("威海市","631");districtPhonePrefix.put("泰安市","538");districtPhonePrefix.put("新泰市","538");districtPhonePrefix.put("曲阜市","537");districtPhonePrefix.put("临沂市","539");districtPhonePrefix.put("枣庄市","632");districtPhonePrefix.put("文登市","631");districtPhonePrefix.put("上海市 21","");districtPhonePrefix.put("上海县 21","");districtPhonePrefix.put("南汇县 21","");districtPhonePrefix.put("金山县 21","");districtPhonePrefix.put("青浦县 21","");districtPhonePrefix.put("宝山县 21","");districtPhonePrefix.put("近郊区 21","");districtPhonePrefix.put("川沙县 21","");districtPhonePrefix.put("奉贤县 21","");districtPhonePrefix.put("松江县 21","");districtPhonePrefix.put("嘉定县 21","");districtPhonePrefix.put("崇明县 21 　 　","");districtPhonePrefix.put("太原市","351");districtPhonePrefix.put("忻州市","350");districtPhonePrefix.put("临汾市","357");districtPhonePrefix.put("运城市","359");districtPhonePrefix.put("长治市","355");districtPhonePrefix.put("榆次市","354");districtPhonePrefix.put("大同市","352");districtPhonePrefix.put("侯马市","357");districtPhonePrefix.put("阳泉市","353");districtPhonePrefix.put("晋城市","356");districtPhonePrefix.put("西安市 29","");districtPhonePrefix.put("延安市","911");districtPhonePrefix.put("榆林市","912");districtPhonePrefix.put("商州市","914");districtPhonePrefix.put("汉中市","916");districtPhonePrefix.put("咸阳市","910");districtPhonePrefix.put("渭南市","913");districtPhonePrefix.put("安康市","915");districtPhonePrefix.put("宝鸡市","917");districtPhonePrefix.put("铜川市","919");districtPhonePrefix.put("成都市 28","");districtPhonePrefix.put("西昌市","834");districtPhonePrefix.put("德阳市","838");districtPhonePrefix.put("雅安市","835");districtPhonePrefix.put("遂宁市","825");districtPhonePrefix.put("万县市","819");districtPhonePrefix.put("南充市","817");districtPhonePrefix.put("内江市","832");districtPhonePrefix.put("宜宾市","831");districtPhonePrefix.put("涪陵市","810");districtPhonePrefix.put("马尔康市","837");districtPhonePrefix.put("乐山市","833");districtPhonePrefix.put("攀枝花市","812");districtPhonePrefix.put("绵阳市","816");districtPhonePrefix.put("广元市","839");districtPhonePrefix.put("重庆市","811");districtPhonePrefix.put("达县市","818");districtPhonePrefix.put("华蓥市","826");districtPhonePrefix.put("自贡市","813");districtPhonePrefix.put("泸州市","830");districtPhonePrefix.put("天津市 22","");districtPhonePrefix.put("汉沽 22","");districtPhonePrefix.put("静海县 22","");districtPhonePrefix.put("宝坻县 22","");districtPhonePrefix.put("塘沽 22","");districtPhonePrefix.put("宁河县 22","");districtPhonePrefix.put("武清县 22","");districtPhonePrefix.put("大港区 22","");districtPhonePrefix.put("乌鲁木齐市","991");districtPhonePrefix.put("石河子市","993");districtPhonePrefix.put("博乐市","909");districtPhonePrefix.put("塔城市","901");districtPhonePrefix.put("阿勒泰市","906");districtPhonePrefix.put("哈密市","902");districtPhonePrefix.put("阿克苏市","997");districtPhonePrefix.put("阿图什市","908");districtPhonePrefix.put("昌吉市","994");districtPhonePrefix.put("奎屯市","992");districtPhonePrefix.put("克拉玛依市","990");districtPhonePrefix.put("伊宁市","999");districtPhonePrefix.put("吐鲁番市","995");districtPhonePrefix.put("库尔勒市","996");districtPhonePrefix.put("喀什市","998");districtPhonePrefix.put("和田市","903");districtPhonePrefix.put("拉萨市","891");districtPhonePrefix.put("山南市","983");districtPhonePrefix.put("昌都市","895");districtPhonePrefix.put("阿里市","897");districtPhonePrefix.put("日喀则市","892");districtPhonePrefix.put("林芝市","894");districtPhonePrefix.put("那曲市","896");
	}
	
	/**
	 * 手机[3]运营商
	 */
	public static String[] mobileTelenorNos = {};// 0-9
 
	/** 
	 * 生成电话号码
	 * EXP: 
	 * genPhoneNO("北京市朝阳区")
	 * 
	 * @param districtName
	 * @return
	 */
	public static String genPhoneNO(String districtName){
		String prefix="";
		for (Iterator iterator = districtPhonePrefix.keySet().iterator(); iterator.hasNext();) {
			String key = (String) iterator.next();
			if(districtName.indexOf(key)>=0){
				prefix=(String)districtPhonePrefix.get(key);
			}
		}
		
		return "0"+prefix+"-"+StringGen.genString(8,StringGen.TYPE_09);
	}
	
	/**
	 * 生成手机号码
	 * 
	 * @return
	 */
	public static String genMobileNO() {
		String typeNum = "";

		typeNum += mobileInNos[random.nextInt(2)];

		typeNum += random.nextInt(10);

		// 地区段待加 mid4
		typeNum += StringUtils.fillEmptyWithStr(random.nextInt(10000), 4, "0");

		// end4
		typeNum += StringUtils.fillEmptyWithStr(random.nextInt(10000), 4, "0");
		return typeNum;
	}
}
